<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/12
 * Time: 12:49
 */

namespace App\Traits\Relation;

use App\Models\User;
use App\Models\Company;

trait ArticleRelation
{
    /**
     * 获取发布者信息
     *
     * Date: 12/04/2018
     * @author Tenny
     * @return BelongsToMany
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id','id' );
    }

    /**
     * 获取文章所属公司
     *
     * Date: 12/04/2018
     * @author Tenny
     * @return BelongsToMany
     */
    public function company()
    {
        return $this->belongsTo(Company::class, 'company_id','id' );
    }
}